<%--
 *  File:    OrgCopyOptionSet.jsp
 *  @Author: Kent Zhong 
 *  Date:    3/3/2005 1:48PM
 *
 *  Copyright (C) 2000 - 2005 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
 

<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.*" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>


<%
  	Category cat = Category.getInstance("jsp.OrgCopyOptionSet");  
%>

<%
	String strModuleName = "IMG";
	String privilegeCode = "Z0823";
  	
  	
%>


<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<html>
<head>
<title>OrgCopyOptionSet</title>
<PageFlow:CheckPageFlow pageName="orgcopyoptionset"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../js/ScriptLib.js"></script>
<%
  Vector optionsset=(Vector)pageContext.getAttribute("optionsset");
  if(optionsset==null)
    optionsset=new Vector();
%>
<script>
function page_orgoptionchange()
{
  thisform.action="OrgCopyOptionSet.jsp?<%= OvalTools.randomURL() %>";
  thisform.target = "_self";
	isRunning = true;
	thisform.submit(); 
}
function page_optionclick(idx)
{
  
  var objoptset=eval("thisform.optionset"+idx);
  var objsetflag=eval("thisform.setflag"+idx);
  if(objoptset.checked)
    objsetflag.value="1";
  else
    objsetflag.value="0";  
 <%-- if(idx=='2' && !objoptset.checked)
  {
    thisform.optionset4.checked=false;
    thisform.optionset8.checked=false;
    thisform.optionset12.checked=false;
    thisform.setflag4.value="0";
    thisform.setflag8.value="0";
    thisform.setflag12.value="0";
    
  }
  if((idx=='4' || idx=='12'  ) && !objoptset.checked)
  {
    thisform.optionset8.checked=false;
    thisform.setflag8.value="0";
  }
  if((idx=='4' || idx=='12' || idx=='8' ) && objoptset.checked)
  {
    thisform.optionset2.checked=true;
    thisform.setflag2.value="1";
  }
  if( idx=='8'  && objoptset.checked)
  {
    thisform.optionset4.checked=true;
    thisform.setflag4.value="1";
    thisform.optionset12.checked=true;
    thisform.setflag12.value="1";
  }--%>
  
}

function page_save()
{
  
  thisform.actionname.value="save";
  thisform.target = "_self";
	isRunning = true;
	thisform.submit(); 
}
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"  Scroll=no >
<form name="thisform" method="post" action="../Dispatcher"  target="_parent">
    <input type="hidden" name="pagename" value="orgcopyoptionset">
    <input type="hidden" name="actionname">
    <input type="hidden" name="numrows" value="<%=JspHelper.filterNull(optionsset.size())%>"/>
<%@ include file="/inc/PageLocation.inc" %>
<table id="topTable" border=0 cellpadding=0 cellspacing=0 width="100%">
  <tr> 
    <td class=summary_top></td>
  </tr>
  <tr> 
    <td class="title-big-b-center" ><%=label.getLabelName("L_OrgCopyOptionSet")%></td>
  </tr>
  <tr>
    <td class=summary_top>
      <table width="60%" border="0" cellspacing="0" cellpadding="0" align="center">
       <tr>
          <td>&nbsp;</td>
        </tr>
        <tr> 
          <td><%=label.getLabelName("L_OrgType")+label.getLabelName("L_Colon")%>
            <custom:select optionsName="orgtypelists" optionValueKey="saleschannelid" optionInnerTextKey="saleschannelname" property="orgtype" defaultValueCost="" defaultValue="-----" onchange="page_orgoptionchange();"/>
            <!--a onclick="page_go();"><img src="../images/<%= strLanguageCode %>/go.gif" width="27" height="14"></a--> 
            </td>
        </tr>
        
      </table>
    </td>
  </tr>
  <tr> 
    <td class=summary_top> 
      <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" align="center" width="60%" cellpadding="1">
        <tr>
          <td width="100%"  height="20" colspan="2"><span class="red"><%=label.getLabelName("L_CopyCentent")+label.getLabelName("L_Colon")%></span></td>
        </tr>  
        
        <logic:iterate id="oneoption" collection="<%= optionsset %>" indexId="idx">
        <%
          String strChecked="";
          String strDisabled="";
          HashMap hmTmp=(HashMap)pageContext.getAttribute("oneoption");
          if(hmTmp==null)
            hmTmp=new HashMap();
          if( hmTmp.get("isreadonly")!=null &&  hmTmp.get("isreadonly").toString().equals("Y"))
          {
            strDisabled="disabled";
            hmTmp.put("setflag","1");
            pageContext.setAttribute("oneoption",hmTmp);
          }
          if( hmTmp.get("setflag")!=null &&  hmTmp.get("setflag").toString().equals("1"))
          {
            strChecked="checked";
          }
          else
          {
            hmTmp.put("setflag","0");
            pageContext.setAttribute("oneoption",hmTmp);
          }
          int iNum=idx.intValue();   
        %>
        <%if(iNum%2==0){%>
        <tr> 
        <%}%>
          <td width="50%"> 
            <custom:hidden name="oneoption" property="orgcopyoptionsetid" colIndex="<%=idx%>"/>
            <custom:hidden name="oneoption" property="optioncode" colIndex="<%=idx%>"/>
            <custom:hidden name="oneoption" property="setflag" colIndex="<%=idx%>"/>
            <input type="checkbox" name="optionset<%=JspHelper.filterNull(idx)%>" value="<custom:write name="oneoption" property="orgcopyoptionsetid"/>"  class="normalradio" <%=JspHelper.filterNull(strChecked)%> <%=JspHelper.filterNull(strDisabled)%> onclick="page_optionclick('<%=JspHelper.filterNull(idx)%>');"/>
            <custom:write name="oneoption" property="optiondesc" nbsp="true"/>
          </td>
        <%if(iNum%2==1){%>
        </tr> 
        <%}%>  
        </logic:iterate>
        <%if(optionsset.size()%2==1){%>
          <td width="50%"> &nbsp;</td>
        </tr>
        <%}%>
      </table>
    </td>
  </tr>
  <tr> 
    <td class=summary_top></td>
  </tr>
  <tr> 
    <td class=td_center> 
    <%if(optionsset.size()>0){%>
      <a onclick="page_save();"><custom:button type="1" label="L_Save" imgsrc="save.gif" border="0" style="width:60"/></a>
      <a onclick="thisform.reset();"><custom:button type="1" label="L_Cancel" imgsrc="cancel.gif" border="0" style="width:60"/></a>
    <%}%>      
    </td>
  </tr>
</table>
</body>
</html>
